package com.yonyou.pmclouds.lock.mapper;

import java.util.Map;

import javax.persistence.Table;

import org.apache.ibatis.jdbc.SQL;

import com.yonyou.pmclouds.basecom.entity.SuperVO;

public class LockSqlProvider {

	public String checkChangeFlag(final Map<String, Object> dataMap) {
		return new SQL() {
			{
				SuperVO vo = (SuperVO) dataMap.get("lockvo");
                SELECT("COUNT(1)"); 
                FROM(vo.getClass().getAnnotation(Table.class).name()); 
                WHERE(vo.pkFiledName() + " = #{lockvo." + vo.pkFiledName().toLowerCase() + "}");
				WHERE("change_flag" + " = #{lockvo.changeFlag}");
			}
		}.toString();
	}

}
